<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
	<meta name="apple-mobile-web-app-capable" content="yes"/>
	<title>Add to Home Screen</title>

	<link href="../themes/common/domButtons/DomButtonSilverCircleRedCross.css" rel="stylesheet"/>
	<script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Button','Tooltip']"></script>
	<script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true, mblAlwaysHideAddressBar: true"></script>

	<script type="text/javascript">
		require([
			"dojo/_base/connect",
			"dojo/cookie",
			"dojo/dom",
			"dojo/dom-class",
			"dojo/ready",
			"dijit/registry",
			"dojox/mobile",
			"dojox/mobile/iconUtils",
			"dojox/mobile/parser",
			"dojox/mobile/compat",
			"dojox/mobile/ScrollableView",
			"dojox/mobile/Button",
			"dojox/mobile/Tooltip"
		], function(connect, cookie, dom, domClass, ready, registry, common, iconUtils){
			var timerShow, timerHide;
			var handler;
			dlgShow = function(){
				dom.byId('dlgRef').style.top = common.getScreenSize().h - 5 + "px";
				registry.byId('dlgBody').show(dom.byId('dlgRef'), ['above-centered']);
				timerHide = setTimeout(function(){
					timerHide = 0;
					dlgHide();
				}, 10000);
			}
			dlgHide = function(){
				if(timerShow){
					clearTimeout(timerShow);
				}
				if(timerHide){
					clearTimeout(timerHide);
				}
				if(handler){
					connect.disconnect(handler);
				}
				registry.byId('dlgBody').hide();
			}
			setCookie = function(){
				cookie("disable-AtHS-Notification", true, {expires:1});
				if(cookie("disable-AtHS-Notification") != undefined){
					registry.byId('clearBtn').set("disabled", false);
				}
			}
			clearCookie = function(){
				cookie("disable-AtHS-Notification", null, {expires:-1});
				registry.byId('clearBtn').set("disabled", true);
			}
			ready(function(){
				iconUtils.createDomButton(dom.byId('dlgClose'));
				if(cookie("disable-AtHS-Notification") == undefined){
					timerShow = setTimeout(function(){
						timerShow = 0;
						dlgShow();
					}, 2000);
					// To hide tooltip window by force before starting view transition
					handler = connect.connect(registry.byId("foo"), "onBeforeTransitionOut", null, function(moveTo, dir, transition, context, method){
						dlgHide();
					});
				}else{
					registry.byId('clearBtn').set("disabled", false);
				}
			});
		});
	</script>

	<style>
	html,body {
		height: 100%;
		overflow: hidden;
	}

	/* sample code */
	#dlgRef {
		position: absolute;
		left: 0;
		width: 100%;
	}
	#dlgBody {
		width: 75%;
		font-family: Helvetica;
		font-size: 14px;
		-webkit-box-shadow: 0 1px 2px 2px rgba(0,0,0,0.3);
		opacity: .9;
	}
	#dlgBody td {
		vertical-align:top;
	}
	/* sample code */
	</style>
</head>
<body style="visibility:hidden;">
	<!-- sample code -->
	<div id="dlgRef">
		<div id="dlgBody" data-dojo-type="dojox.mobile.Tooltip" class="mblTooltipBubble">
			<table>
				<tr>
					<td><img alt="" src="images/tab-icon-12.png"></td>
					<td width="99%"><b>Sample of &quot;Add to Home Screen&quot; notification</b><br><br>
					This window will be hidden in ten seconds automatically.<br>
					If you click the close button, the window is not displayed from next time until you click the &quot;Clear Cookie&quot; button.</td>
					<td><div id="dlgClose" class="mblDomButtonSilverCircleRedCross" onclick="setCookie();dlgHide()"></div></td>
				</tr>
			</table>
		</div>
	</div>
	<!-- sample code -->
	
	<div id="view1" data-dojo-type="dojox.mobile.ScrollableView">
		<div data-dojo-type="dojox.mobile.RoundRect">
			<b>Sample of &quot;Add to Home Screen&quot; notification using the Tooltip widget.</b><br>
			<br>
			<button id="clearBtn" data-dojo-type="dojox.mobile.Button" disabled onclick="clearCookie()">Clear Cookie</button><br>
			- When &quot;Clear Cookie&quot; button is active, the notification window is not displayed.<br>
			- After clicking button, reload this page by manually.
		</div>

		<ul data-dojo-type="dojox.mobile.RoundRectList">
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-1.png", moveTo:"view2", transition:"slide"'>
				Slide 1
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-2.png", moveTo:"view2", transition:"flip"'>
				Flip 2
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-3.png", moveTo:"view2", transition:"fade"'>
				Fade 3
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-4.png", moveTo:"view2", transition:"slide"'>
				Slide 4
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-5.png", moveTo:"view2", transition:"flip"'>
				Flip 5
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-6.png", moveTo:"view2", transition:"fade"'>
				Fade 6
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-7.png", moveTo:"view2", transition:"slide"'>
				Slide 7
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-8.png", moveTo:"view2", transition:"flip"'>
				Flip 8
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-9.png", moveTo:"view2", transition:"fade"'>
				Fade 9
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-1.png", moveTo:"view2", transition:"slide"'>
				Slide 10
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-2.png", moveTo:"view2", transition:"flip"'>
				Flip 11
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-3.png", moveTo:"view2", transition:"fade"'>
				Fade 12
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-4.png", moveTo:"view2", transition:"slide"'>
				Slide 13
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-5.png", moveTo:"view2", transition:"flip"'>
				Flip 14
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" data-dojo-props='icon:"images/i-icon-6.png", moveTo:"view2", transition:"fade"'>
				Fade 15
			</li>
		</ul>
	</div>

	<div id="view2" data-dojo-type="dojox.mobile.ScrollableView">
		<h1 data-dojo-type="dojox.mobile.Heading" data-dojo-props='fixed:"top", back:"Home", moveTo:"view1"'>Search Result</h1>
		<ul data-dojo-type="dojox.mobile.RoundRectList" data-dojo-props='variableHeight:true'>
			<li data-dojo-type="dojox.mobile.ListItem" style="font-size:10px">
				1. <a href="#" class="lnk">Dojo: Traditional Karate-do Spirit</a><br>
				Sarah Connor Hardcover<br>
				Eligible for FREE Super Saver Shipping<br>
				<span style="color:red">$14.50 (50%)</span> In Stock<br>
				# (531)
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" style="font-size:10px">
				2. <a href="#" class="lnk">Japanese Martial Arts Dojo</a><br>
				Martin Parker Hardcover<br>
				<span style="color:red">$14.00 (60%)</span> In Stock<br>
				# (173)
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" style="font-size:10px">
				3. <a href="#" class="lnk">Total Solar Eclipse</a><br>
				Steven Young Hardcover<br>
				Get it by Mar. 2 if you order in the next <span style="color:green"><b>16 hours</b></span><br>
				Eligible for FREE Super Saver Shipping<br>
				<span style="color:red">$9.50 (62%)</span> In Stock<br>
				# (1199)
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" style="font-size:10px">
				4. <a href="#" class="lnk">The History of Java Coffee</a><br>
				Marco Rodriguez Hardcover<br>
				<span style="color:blue">Not Available</span>
			</li>
			<li data-dojo-type="dojox.mobile.ListItem" style="font-size:10px">
				5. <a href="#" class="lnk">The Principles of Spider's Web</a><br>
				Melissa Morgan Hardcover<br>
				Eligible for FREE Super Saver Shipping<br>
				<span style="color:red">$12.00 (60%)</span> In Stock<br>
				# (1847)
			</li>
		</ul>
	</div>
</body>
</html>
